package com.example.socketio.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

//消息表
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Message {
	//messageList.push( {type:type,contentType:contentType,
	//content:content,time:_dateTimeFormatter(new Date()),
	//from:from,fromavatar:avata,to:to})
    private String type;
    private String contentType;
   // @JsonFormat(pattern="yyyy-MM-dd HH:mm:SS")
    private String time ;
    private String content;
    private String from;
    private String fromavata;
    private String to; 
    
    @Override
    public int hashCode() {
    	int result = 0 ;
    	if(type!=null) {
    		result += type.hashCode();
    	}
    	if(contentType!=null) {
    		result += contentType.hashCode();
    	}
    	if(time!=null) {
    		result+=time.hashCode();
    	}
    	if(content!=null) {
    		result+=content.hashCode();
    	}
    	if(from !=null) {
    		result+=from.hashCode();
    	}
    	if(fromavata !=null) {
    		result+=fromavata.hashCode();
    	}
    	if(to !=null) {
    		result+=to.hashCode();
    	}
    	
    	
    	return result;
    }
    
    @Override
    public String toString() {
    	return "time="+time+" ,from:"+from+"=>"+to+" ,type="+type+",contentType:"+contentType+",content="+content;
    }
}
